Emulate BaselineSet

Good day.
I'm trying to emulate the function BaselineSet from a button in a GUI.
The thing is I use the eval_ function and it does not work.
 

eval_"#include<standard/BaselineSetDefinition/NewBaselineSet.dxl>"

 

I also tried what the dxl manual suggests: create(Folder f, string name, string desc, BaselineSetDefinition &bsd)

 

 

Folder f = folder("/OIOIOI_Systems")
create(Folder f, "BaselineSetCompleteness", "", BaselineSetDefinition &bsd)



In this case I'm having a interpretation problem, I'm not getting what is wrong, since DOORS tell me it got a Syntax Error.
Like always I will try to find the answer here, but I appreciate if someone enlighten me.

Thanks!



 

 


Bruwbruw - Wed Oct 24 12:26:56 EDT 2012

Re: Emulate BaselineSet
Bruwbruw - Wed Oct 24 12:47:53 EDT 2012

ooops! =)
I forgot the rest...this is the code:
 

void createBSD()
Folder f = folder("/OIOIOI_Systems")
{
BaselineSetDefinition newBSD = null
string bsdName = "BaselineSetCompleteness modules"
string bsdDesc = "Modules from completeness"
string errmess
errmess = create(f, bsdName, bsdDesc, newBSD)
if (!null errmess)
{
errorBox "Unable to create a new Baseline Set" errmess
return
}
errmess = lock(newBSD)
{
errorBox "Cannot lock new Baseline Set Definition" errmess
return
}
 
//ADD MODULES
Item i
ModName_mod
for i in f do{
if (type(i) == "Formal")
{
    mod = module(fullName i)
    { 
        if (!null mod)
            {
            errmess = addModule(mod, newBSD)
            if (!null errmess)
            {
                errorBox "Could not add module" name(mod)" : " errmess
            }
        }
       }
}
}
errmess = save(newBSD)
if (!null errmess)
{
    errorBox "Failed to save Definition" errmess
}
    unlock(newBSD)
}
createBSD

 


I got the errors:
-E- DXL: <Line:22> Variável não declarada (ModName_mod)
-E- DXL: <Line:30> Argumentos incorretos para a função (addModule)
-E- DXL: <Line:33> Argumentos incorretos para a função (name)
-E- DXL: Tipo de retorno incorreto
-E- DXL: Tipo de retorno incorreto

something like <Line:22> not declared variable (ModName_mod)
<Line:30> incorrect argumments (addModule)
<Line:33> incorrect argumments (name)
-E- DXL: incorrect return type

 

Re: Emulate BaselineSet
llandale - Wed Oct 24 16:30:48 EDT 2012

Bruwbruw - Wed Oct 24 12:47:53 EDT 2012

ooops! =)
I forgot the rest...this is the code:
 

void createBSD()
Folder f = folder("/OIOIOI_Systems")
{
BaselineSetDefinition newBSD = null
string bsdName = "BaselineSetCompleteness modules"
string bsdDesc = "Modules from completeness"
string errmess
errmess = create(f, bsdName, bsdDesc, newBSD)
if (!null errmess)
{
errorBox "Unable to create a new Baseline Set" errmess
return
}
errmess = lock(newBSD)
{
errorBox "Cannot lock new Baseline Set Definition" errmess
return
}
 
//ADD MODULES
Item i
ModName_mod
for i in f do{
if (type(i) == "Formal")
{
    mod = module(fullName i)
    { 
        if (!null mod)
            {
            errmess = addModule(mod, newBSD)
            if (!null errmess)
            {
                errorBox "Could not add module" name(mod)" : " errmess
            }
        }
       }
}
}
errmess = save(newBSD)
if (!null errmess)
{
    errorBox "Failed to save Definition" errmess
}
    unlock(newBSD)
}
createBSD

 


I got the errors:
-E- DXL: <Line:22> Variável não declarada (ModName_mod)
-E- DXL: <Line:30> Argumentos incorretos para a função (addModule)
-E- DXL: <Line:33> Argumentos incorretos para a função (name)
-E- DXL: Tipo de retorno incorreto
-E- DXL: Tipo de retorno incorreto

something like <Line:22> not declared variable (ModName_mod)
<Line:30> incorrect argumments (addModule)
<Line:33> incorrect argumments (name)
-E- DXL: incorrect return type

 

You need to add a space:
  • ModName_ mod
"ModName_mod" is a single identifier (undeclared), which will cause future references to "mod" to be undefined as well.

-Louie

Re: Emulate BaselineSet
Bruwbruw - Thu Oct 25 08:43:33 EDT 2012

llandale - Wed Oct 24 16:30:48 EDT 2012
You need to add a space:

  • ModName_ mod
"ModName_mod" is a single identifier (undeclared), which will cause future references to "mod" to be undefined as well.

-Louie

I see...
But for example, when I tried to call the DOORS BaselineSet function from a eval_ it does not work. I have noticed that the script is encrypted. That is a problem?

Anyway...if I was trying to understand the dxl your tip helped me, I haven't notice the space in the ModName_ mod.
So now I'm trying to get this structure and adapted it to one that I have, the one that have does the this: It open the modules that are selected from a three view.
This is the dxl:
 

void openModules() {
    Item selItem
        int selItemToken
        Module selMod
        
        for (selItemToken=0; selItemToken<noElems(selectedListView); selItemToken++) {
                raise(selectModulesDB)
                selItem = item(get(selectedListView, selItemToken))
 
                if (null selItem) {
                        // If not found, then not found
                        set(selectedListView, selItemToken)
                } else {
                        if (type(selItem)!="Formal") {
                                // If not a formal module, it's not applicable
                                set(selectedListView, selItemToken)
                        } else {
                                selMod = edit(rootName_(selItem), false, false, true)
                                if (null selMod) {
                                        // If not found, then not found
                                        set(selectedListView, selItemToken)
                                }  
                        } 
                } 
        }
}

 


So using this I tried this:

 

 

void createBSD(){
BaselineSetDefinition newBSD
BaselineSet newBS
Item i
Folder f = folder("/EMB550_04_Systems")
string errmess
Skip moduleSkip = create
bool major = false
int skipIndex = 0
int selItemToken
 
errmess = create(f, "Completeness BaselineSet", "oioioi", newBSD)
save(newBSD)
lock(newBSD)
 
    for (selItemToken=0; selItemToken<noElems(selectedListView); selItemToken++) {
                raise(selectModulesDB)
                i = item(get(selectedListView, selItemToken))
 
                if (null i) {
                        // If not found, then not found
                        set(selectedListView, selItemToken)
                } else {
                        if (type(i) == "Formal"){
                        selMod = module(fullName i)
                        addModule(selMod, newBSD)
                        
                        put(moduleSkip, skipIndex, selMod)
                        
            create(newBSD, major, "Test", "Hello", newBS)
            unlock(newBSD)
                        
                        string check = addBaselines(moduleSkip, newBS)
                          
                        } 
                } 
        }
        close(newBS)
        save(newBSD)
    delete(moduleSkip)
 }



But the DOORS says that my addModule is incorrect.
Thanks anyway!



 

Re: Emulate BaselineSet
Bruwbruw - Thu Oct 25 12:59:36 EDT 2012

Okay...I'm trying piece by piece...
Looking through the forum, I see this code...the problem is, in the first time I run, it worked, then later its not working anymore. Someone can help?
 

//Define Variables
void creatBSD(){
Folder f = current
BaselineSetDefinition newBSD = null
BaselineSet newBS
ModName_ mod
Module m = current
int skipIndex = 0
Skip moduleSkip = create
bool major = false
 
string modpath = fullName(m)
mod = module(modpath)
close(m)
 
//Create, save and lock baseline set definition
create(f, "BaselineSet Test", "descrição", newBSD)
save(newBSD)
lock(newBSD)
 
//Add module to BSD
addModule(mod, newBSD)
 
//Add module to skiplist
put(moduleSkip, skipIndex, mod)
 
//Create baseline set
create(newBSD, major, "Teste", "oioioi", newBS)
unlock(newBSD)
 
//Add baselines to baseline set
string check = addBaselines(moduleSkip, newBS)
if (!null check)
{
    print "error"
}
 
//close variables
close(newBS)
delete(moduleSkip)
}

Re: Emulate BaselineSet
llandale - Thu Oct 25 15:21:17 EDT 2012

Bruwbruw - Thu Oct 25 12:59:36 EDT 2012

Okay...I'm trying piece by piece...
Looking through the forum, I see this code...the problem is, in the first time I run, it worked, then later its not working anymore. Someone can help?
 

//Define Variables
void creatBSD(){
Folder f = current
BaselineSetDefinition newBSD = null
BaselineSet newBS
ModName_ mod
Module m = current
int skipIndex = 0
Skip moduleSkip = create
bool major = false
 
string modpath = fullName(m)
mod = module(modpath)
close(m)
 
//Create, save and lock baseline set definition
create(f, "BaselineSet Test", "descrição", newBSD)
save(newBSD)
lock(newBSD)
 
//Add module to BSD
addModule(mod, newBSD)
 
//Add module to skiplist
put(moduleSkip, skipIndex, mod)
 
//Create baseline set
create(newBSD, major, "Teste", "oioioi", newBS)
unlock(newBSD)
 
//Add baselines to baseline set
string check = addBaselines(moduleSkip, newBS)
if (!null check)
{
    print "error"
}
 
//close variables
close(newBS)
delete(moduleSkip)
}

I don't know anything about Baseline Sets so cannot help there.

You need to help us out here more.
  • "Doesn't work" is pretty ambiguous.
  • your code doesn't interpret because you are providing only part of it

In your previous post ...

... line 28 you are using the same Key (skipIndex) for all attempted "puts", which will result in only one value in the skip. Seems like you need one of these:
  • put(moduleSkip, skipIndex++, selMod)
  • put(moduleSkip, selItemToken, selMod) // and remove other reference to skipIndex
However, looking at how that skip is used in function addBaselines; that function appears to want a Skip of "ModName_"; so I would suppose you need this instead:
  • put(moduleSkip, selMod, selMod)
presuming you first declare:
  • ModName_ selMod

In this example ...

Don't use "m = current"; send the Module handle into the Function. I've argued ad-nausium against using a statement like that since the "current" module changes as modules are opened, and it is difficult to guess when the "current" module will change. I'm guessing this is your "works first time but not 2nd time" problem; since the 1st time a module is actually opened which changes "current"; but the 2nd time that module is already open and issuing a "read" on it does NOT change the "current" module.
Somewhere else you would have:
  • m = read("some other module")
As it sets "m" whether the module was previously opened or not.

-Louie

Re: Emulate BaselineSet
Bruwbruw - Fri Oct 26 06:30:03 EDT 2012

llandale - Thu Oct 25 15:21:17 EDT 2012
I don't know anything about Baseline Sets so cannot help there.

You need to help us out here more.

  • "Doesn't work" is pretty ambiguous.
  • your code doesn't interpret because you are providing only part of it

In your previous post ...

... line 28 you are using the same Key (skipIndex) for all attempted "puts", which will result in only one value in the skip. Seems like you need one of these:
  • put(moduleSkip, skipIndex++, selMod)
  • put(moduleSkip, selItemToken, selMod) // and remove other reference to skipIndex
However, looking at how that skip is used in function addBaselines; that function appears to want a Skip of "ModName_"; so I would suppose you need this instead:
  • put(moduleSkip, selMod, selMod)
presuming you first declare:
  • ModName_ selMod

In this example ...

Don't use "m = current"; send the Module handle into the Function. I've argued ad-nausium against using a statement like that since the "current" module changes as modules are opened, and it is difficult to guess when the "current" module will change. I'm guessing this is your "works first time but not 2nd time" problem; since the 1st time a module is actually opened which changes "current"; but the 2nd time that module is already open and issuing a "read" on it does NOT change the "current" module.
Somewhere else you would have:
  • m = read("some other module")
As it sets "m" whether the module was previously opened or not.

-Louie

Hehehe...
I got a little desesperated here, and I confuse myself.
Thanks for the tip.
I made some changes its doing what its supossed to, and thanks for the skip part, its was my next question!
This baseline thing is more annoying than I thought.

Thanks again!